#include <QCoreApplication>
#include "demo.h"
#include <iostream>
#include <functional>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    Demo d;
#if 1
    QObject::connect(&d, &Demo::echo, [](const QString& str) {
        std::cout << str.toStdString() << std::endl;
    });
    QObject::connectNotify()
#else
    auto f = [](const QString& str) -> void {
        std::cout << str.toStdString() << std::endl;
    };
    QObject::connect(&d, SIGNAL(echo),  SLOT(f));

#endif
    d.echo("haha");
    emit d.echo("hello");


    return a.exec();
}
